<? $secNameID =intval($_GET['secName']);
$roomNameId=intval($_GET['roomName']);
$link = mysql_connect('localhost', 'root', ''); //changet the configuration in required
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('elearning');
$query="SELECT u.userid, s.sectionid, u.fname,u.lname,u.mname,s.roomName,s.sectionAdviser
	    FROM tbluser u INNER JOIN tblsection s ON s.sectionAdviser = u.userid
	    WHERE s.studentName = 'none' AND s.sectionid = '$secNameID' AND u.userid = s.sectionAdviser ";
$result=mysql_query($query);

?>
<select name="secAd">
<option>Select Adviser</option>
<? while($row=mysql_fetch_array($result)) { 
$fullname =	$row['fname'] . " ". $row['mname'] . " ". $row['lname'];
$id = $row['sectionAdviser'];
?>
<option value = <? print($id);?> ><? print($fullname); ?></option>
<? print($query); ?>
<? } ?>
</select>
